import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { CasinoController } from "./casino.controller";
import { CasinoService } from "./casino.service";
import { CasinoBetService } from "./services/casino-bet.service";
import { CasinoSettlementService } from "./services/casino-settlement.service";
import { CasinoSchedulerService } from "./services/casino-scheduler.service";
import { CasinoCacheService } from "./services/casino-cache.service";
import { CasinoChibiRoundService } from "./services/casino-chibi-round.service";
import { CasinoDiceRoundService } from "./services/casino-dice-round.service";
import { CasinoUnifiedRoundService } from "./services/casino-unified-round.service";
import { SystemMessageService } from "../../services/system-message.service";
import { PrivateMessageService } from "../../services/private-message.service";
import { CharacterService } from "../../services/character.service";
import { CharacterAttributeService } from "../../services/character-attribute.service";
import { CharacterSkillService } from "../../services/character-skill.service";
import { DeputyGeneralService } from "../../services/deputy-general.service";
import { DeputyGeneralModule } from "../deputy-general/deputy-general.module";

// 实体
import { CasinoDiceBet } from "./entities/casino-dice-bet.entity";
import { CasinoChibiBet } from "./entities/casino-chibi-bet.entity";
import { CasinoRockPaperScissors } from "./entities/casino-rock-paper-scissors.entity";
import { CasinoDiceRound } from "./entities/casino-dice-round.entity";
import { CasinoChibiRound } from "./entities/casino-chibi-round.entity";
import { CasinoRanking } from "./entities/casino-ranking.entity";
import { CasinoConfig } from "./entities/casino-config.entity";
import { CasinoOperationLog } from "./entities/casino-operation-log.entity";
import { CharacterResourcesEntity } from "../../entities/character-resources.entity";
import { CharacterEntity } from "../../entities/character.entity";
import { CharacterAttributeEntity } from "../../entities/character-attribute.entity";
import { CharacterDetailedAttributeEntity } from "../../entities/character-detailed-attribute.entity";
import { CharacterSkillEntity } from "../../entities/character-skill.entity";
import { SocialRelationEntity } from "../../entities/social-relation.entity";
import { CharacterReligionEntity } from "../../entities/character-religion.entity";
import { CharacterResidenceEntity } from "../../entities/character-residence.entity";
import { CharacterStoneEntity } from "../../entities/character-stone.entity";
import { CharacterInventoryEntity } from "../../entities/character-inventory.entity";
import { CharacterLocationEntity } from "../../entities/character-location.entity";
import { CharacterMountEntity } from "../../entities/character-mount.entity";
import { CharacterAttributePointsEntity } from "../../entities/character-attribute-points.entity";
import { CharacterEquipmentEntity } from "../../entities/character-equipment.entity";
import { CharacterEquipmentInventoryEntity } from "../../entities/character-equipment-inventory.entity";
import { CharacterMedicineEntity } from "../../entities/character-medicine.entity";
import { LevelExperienceEntity } from "../../entities/level-experience.entity";
import { SkillUpgradeThresholdEntity } from "../../entities/skill-upgrade-threshold.entity";
import { DeputyGeneral } from "../../entities/deputy-general.entity";
import { DeputyGeneralBase } from "../../entities/deputy-general-base.entity";
import { PlayerDeputy } from "../../entities/player-deputy.entity";
import { DeputyGeneralSkillLearned } from "../../entities/deputy-general-skill-learned.entity";
import { SkillBase } from "../../entities/skill-base.entity";
import { PlayerDeputyWarehouse } from "../../entities/player-deputy-warehouse.entity";
import { SystemMessageEntity } from "../../entities/system-message.entity";
import { PrivateMessageEntity } from "../../entities/private-message.entity";
import { GemAttributeEntity } from "../../entities/gem-attribute.entity";
import { EquipmentGemSocketEntity } from "../../entities/equipment-gem-socket.entity";

// 导入RedisModule
import { RedisModule } from "../redis.module";

@Module({
  imports: [
    TypeOrmModule.forFeature([
      // 下注表
      CasinoDiceBet,
      CasinoChibiBet,
      CasinoRockPaperScissors,

      // 期数表（分表）
      CasinoDiceRound,
      CasinoChibiRound,

      // 其他表
      CasinoRanking,
      CasinoConfig,
      CasinoOperationLog,

      // 用户相关表
      CharacterResourcesEntity,
      CharacterEntity,
      CharacterAttributeEntity,
      CharacterDetailedAttributeEntity,
      CharacterSkillEntity,
      SocialRelationEntity,
      CharacterReligionEntity,
      CharacterResidenceEntity,
      CharacterStoneEntity,
      CharacterInventoryEntity,
      CharacterLocationEntity,
      CharacterMountEntity,
      CharacterAttributePointsEntity,
      CharacterEquipmentEntity,
      CharacterEquipmentInventoryEntity,
      CharacterMedicineEntity,
      // 等级经验表（CharacterService 依赖）
      LevelExperienceEntity,
      // 技能升级阈值表（CharacterSkillService 依赖）
      SkillUpgradeThresholdEntity,

      // 副将相关表
      DeputyGeneral,
      DeputyGeneralBase,
      PlayerDeputy,
      DeputyGeneralSkillLearned,
      SkillBase,
      PlayerDeputyWarehouse,

      // 系统消息表
      SystemMessageEntity,

      // 私信表
      PrivateMessageEntity,

      // 宝石属性表
      GemAttributeEntity,
      // 装备宝石镶嵌表（CharacterAttributeService 需要其仓库）
      EquipmentGemSocketEntity,
    ]),
    RedisModule, // 添加RedisModule导入
    DeputyGeneralModule,
  ],
  controllers: [CasinoController],
  providers: [
    CasinoService,
    CasinoBetService,
    CasinoSettlementService,
    CasinoSchedulerService,
    CasinoCacheService,
    CasinoChibiRoundService,
    CasinoDiceRoundService,
    CasinoUnifiedRoundService,
    SystemMessageService,
    PrivateMessageService,
    CharacterService,
    CharacterAttributeService,
    CharacterSkillService,
  ],
  exports: [
    CasinoService,
    CasinoBetService,
    CasinoSettlementService,
    CasinoSchedulerService,
    CasinoCacheService,
    CasinoChibiRoundService,
    CasinoDiceRoundService,
    CasinoUnifiedRoundService,
    SystemMessageService,
    PrivateMessageService,
    CharacterService,
    CharacterAttributeService,
    CharacterSkillService,
  ],
})
export class CasinoModule {}
